import api from '@/api/index.js';
import store from "@/store/index.js"
import { getCommentAction} from "@/store/actions/commentAction.js"

export default async function articleDetailLoadsh({params}) {
    const {slug} = params;
    const response = await api.article.getArticlesBySlug(slug);
    if (response && response.status !== 1) {
        throw new Error(response.message)
    }
    // 获取文章评论
    store.dispatch(getCommentAction(slug));
    return response.data;
}